local skill = fk.CreateSkill {
  name = "#ling__qinggang_sword_skill",
  tags = { Skill.Compulsory },
  attached_equip = "ling__qinggang_sword",
}

Fk:loadTranslationTable{
  ["#ling__qinggang_sword_skill"] = "青釭剑",
}

skill:addEffect(fk.TargetSpecified, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skill.name) and
      data.card and data.card.trueName == "slash" and not data.to.dead
  end,
  on_cost = function(self, event, target, player, data)
    event:setCostData(self, { tos = { data.to.id } })
    return true
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:broadcastPlaySound("./packages/standard_cards/audio/card/qinggang_sword")
    room:setEmotion(player, "./packages/standard_cards/image/anim/qinggang_sword")
    data.to:addQinggangTag(data)
  end,
})
--[[
skill:addEffect(fk.BeforeCardsMove, {
  global = true,
  can_refresh = function (self, event, target, player, data)
    for _, move in ipairs(data) do
      if move.to == player and move.toArea == Card.PlayerEquip then
        for _, info in ipairs(move.moveInfo) do
          if Fk:getCardById(info.cardId).name == skill.attached_equip then
            return true
          end
        end
      end
    end
  end,
  on_refresh = function (self, event, target, player, data)
    for _, move in ipairs(data) do
      if move.to == player and move.toArea == Card.PlayerEquip then
        for _, info in ipairs(move.moveInfo) do
          if Fk:getCardById(info.cardId).name == skill.attached_equip then
            player.room:addPlayerEquipSlots(player, Player.WeaponSlot)
          end
        end
      end
    end
  end,
})
]]
return skill
